package com.pv.bfc.web.validator;

import org.springframework.validation.Errors;
import org.springframework.validation.ValidationUtils;
import org.springframework.validation.Validator;

import com.pv.bfc.model.Folder;

public class FolderValidator implements Validator {

	@SuppressWarnings("unchecked")
	public boolean supports(Class clazz) {
		return Folder.class.isAssignableFrom(clazz);
	}

	public void validate(Object folder, Errors errors) {

		ValidationUtils.rejectIfEmptyOrWhitespace(errors, "folderName",
				"error.required.name");

	}

}
